{% extends 'base.html' %}
{% block title %}
    论坛
{% endblock %}
{% block link %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/detail.css') }}">
    {#    <link href="https://unpkg.com/prismjs@latest/themes/prism.css" rel="stylesheet">#}
    <link rel="stylesheet" href="{{ url_for('static', filename='css/editer.css') }}">



    <meta name="viewport" content="width=device-width, initial-scale=1"/>
{% endblock %}

{% block content %}

    <!-- 文章分类 -->
    <div class="container father">
        <div class="row">
            <div class="col-sm-9 col-12">
                <div class="col-12" style="background-color: hsla(0, 100%, 100%, 0.5);;padding: 20px; border-radius: 10px;
    border: 1px solid #cccccc;">
                    <h3 class="page-title">{{ question.title }}</h3>

                    {% if not is_favorite %}
                        <span style="margin-left: 750px;cursor: pointer;" class="favorite">收藏文章</span>
                    {% else %}
                        <span style="margin-left: 750px;cursor: pointer;" class="cancel_favorite">取消收藏</span>

                    {% endif %}


                    <p class="question-info">
                        <span>作者：{{ question.author.username }}</span>
                        <span>类别：{{ question.category.name }}</span>
                        <span>时间：{{ question.create_time|date }}</span>
                        <span>阅读：{{ question.readcount }}</span>
                        <span>积分：{{ question.credit }}</span>
                    </p>
                    <hr>
                    <div class="question-content editor-content-view">
                        {{ question.content|safe }}
                    </div>
                    <hr>
                    <div>
                        <button type="button" class="btn btn-success" style="margin-left: 50px;" id="p_success">通过</button>
                        <button type="button" class="btn btn-danger" style="margin-left: 50px;" id="p_pass">不通过</button>
                    </div>


                </div>


            </div>


            <!-- 侧边栏 -->
            {% include 'side.html' ignore missing %}

        </div>
    </div>



{% endblock %}

{% block bottom %}
    <script src="https://unpkg.com/prismjs@latest/prism.js"></script>
    <!-- <script src="https://cdn.jsdelivr.net/npm/prismjs@latest/components/prism-core.min.js"></script> -->
    <script src="https://unpkg.com/prismjs@latest/components/prism-core.js"></script>
    <!-- <script src="https://cdn.jsdelivr.net/npm/prismjs@latest/plugins/autoloader/prism-autoloader.min.js"></script> -->
    <script src="https://unpkg.com/prismjs@latest/plugins/autoloader/prism-autoloader.js"></script>
    <script src="/static/js/article/detail.js"></script>
    <script src="/static/js/article/blog.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>

    <script>
        const article_id = {{ question.id }};
        $(document).on('click', '#p_success', function() {

            var confirmation = confirm('确定要通过吗？');
            if (confirmation) {
                $.ajax({
                    url: '/user/judge_article?article_id=' + article_id + '&type=1',
                    method: 'POST',
                    success: function(data) {
                        window.location.href = '/user/article_center?type=5'
                    }
                });
            }
        });
        $(document).on('click', '#p_pass', function() {

            var confirmation = confirm('确定要不通过吗？');
            if (confirmation) {
                $.ajax({
                    url: '/user/judge_article?article_id=' + article_id + '&type=2',
                    method: 'POST',
                    success: function(data) {
                        window.location.href = '/user/article_center?type=5'
                    }
                });
            }
        });

    </script>

{% endblock %}

